﻿<%@ Page Language="c#" CodeBehind="WorkflowExecution.aspx.cs" AutoEventWireup="false"
    Inherits="BEGDC.CC.Web.Workflow.WorkflowExecution" %>

<%@ Register TagPrefix="uc2" TagName="Banner" Src="../UserControls/Banner.ascx" %>
<%@ Register TagPrefix="uc2" TagName="Menu" Src="../UserControls/Menu.ascx" %>
<%@ Register TagPrefix="uc2" TagName="Title" Src="../UserControls/Title.ascx" %>
<%@ Register TagPrefix="uc3" TagName="StampCtrl2" Src="../Common/StampCtrl2.ascx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Workflow Execution</title>
    <link href="../css/global.css" rel="stylesheet" type="text/css" />
    <link href="../css/flow.css" rel="stylesheet" type="text/css" />
    <link href="../css/footer.css" rel="stylesheet" type="text/css" />
    <link href="../css/style_fu.css" rel="stylesheet" type="text/css" />
    <link href="../css/content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../js/jquery-ui.min.js" type="text/javascript"></script>

    <script src="../js/jquery.query-2.1.7.js" type="text/javascript"></script>
    
    <script src="../js/common.js" type="text/javascript"></script>

    <script src="../js/alert.vbs" type="text/vbscript"></script>

    <script src="../js/ccworkflow.js" type="text/javascript"></script>

    <script src="../js/checkform.js" type="text/javascript"></script>

    <script src="../js/workflow.js.aspx" type="text/javascript"></script>

    <script type="text/javascript">
		function GoToNewTab(type)
		{	
			var btnSave = null;
			var appID = '<%=Session["AppID"]%>';
			if (appID != '')
			    appID = parseInt(appID);
			else
			    return;
			
			if(type == '')
				return;
			
			var url = window.location.href;
			if(url.indexOf("Type=App") > 0 && document.Form1.tbIsSwitch.value == '1' )//&& url.indexOf("AppID") < 0)
			{
				document.Form1.tbURL.value = "";
				url = url.substring(0, url.length-9);
				if(url.indexOf("&IsSur=Y") == -1)
				{
					if(document.Form1.tbIsSurvey.value == 'Y')
					{
						url = url + "&IsSur=Y";
					}
				}
				if(url.indexOf("&IsMee=Y") == -1)
				{
					if(document.Form1.tbIsMeetingMinutes.value == 'Y')
					{
						url = url + "&IsMee=Y";
					}
				}
				if(appID > 0 && url.indexOf("AppID") < 0)
					url = url + "&AppID=" + appID;
				url = url + "&Type="+type;
				document.Form1.tbURL.value = url;	
				
				btnSave = window.document.getElementById("_ctl3_btnSave");
				if( btnSave != null )
				{
					document.Form1.tbSwitchTab.value = type;
					btnSave.click();
					return;
				}
				else
				{
					btnSave = window.document.getElementById("_ctl3_ibtnSave");
					if( btnSave != null )
					{
						document.Form1.tbSwitchTab.value = type;
						btnSave.click();
						return;
					}
					else 
					{
						btnSave = window.document.getElementById("_ctl3_Btn_Save");
						if( btnSave != null )
						{
							document.Form1.tbSwitchTab.value = type;
							//document.Form1.tbIsSwitch.value = '';
							//document.Form1.tbURL.value = 'NoAlert';
							btnSave.click();
							//document.Form1.tbIsSwitch.value = '1';
							return;
						}
						else
						{
							url = url.substring(0, url.length-9);
							if(url.indexOf("&IsSur=Y") == -1)
							{
								if(document.Form1.tbIsSurvey.value == 'Y')
								{
									url = url + "&IsSur=Y";
								}
							}
							if(url.indexOf("&IsMee=Y") == -1)
							{
								if(document.Form1.tbIsMeetingMinutes.value == 'Y')
								{
									url = url + "&IsMee=Y";
								}
							}
							if(appID > 0 && url.indexOf("AppID") < 0)
								url = url + "&AppID=" + appID;
							url = url + "&Type="+type;
							document.Form1.tbURL.value = url;
							window.location.href = url;
						}
					}
				}	
			}
			else if(url.indexOf("Type=Att") > 0 && document.Form1.tbIsSwitch.value == '1')
			{
				document.Form1.tbURL.value = "";
				url = url.substring(0, url.length-9);
				if(url.indexOf("&IsSur=Y") == -1)
				{
					if(document.Form1.tbIsSurvey.value == 'Y')
					{
						url = url + "&IsSur=Y";
					}
				}
				if(url.indexOf("&IsMee=Y") == -1)
				{
					if(document.Form1.tbIsMeetingMinutes.value == 'Y')
					{
						url = url + "&IsMee=Y";
					}
				}
				if(appID > 0 && url.indexOf("AppID") < 0)
					url = url + "&AppID=" + appID;
				url = url + "&Type="+type;
				document.Form1.tbURL.value = url;
				
				btnSave = window.document.getElementById("_ctl3_btnAttach");
				if( btnSave != null )
				{
					var objFile=document.getElementsByTagName("INPUT");
					var re = / /g;
					var n=0;
					for (var i=0;i<objFile.length;i++)
					{
						if (objFile[i].id.indexOf("file") >=0 )
						{
							if (objFile[i].value.replace(re,"") != "")
							{
								n++;
							}
						}
					}
					if (n>0)
					{
						
						btnSave.click();
					}
					else
					{	
						window.location.href = url;
					}
				}
				else
				{				
					window.location.href = url;
				}
			}
			else if(document.Form1.tbIsMeetingMinutes.value == 'Y' && (url.indexOf("Type=App") > 0 || url.indexOf("Type=Mee") > 0))
			{
				document.Form1.tbURL.value = "";
				url = url.substring(0, url.length-9);
				if(url.indexOf("&IsSur=Y") == -1)
				{
					if(document.Form1.tbIsSurvey.value == 'Y')
					{
						url = url + "&IsSur=Y";
					}
				}
				if(url.indexOf("&IsMee=Y") == -1)
				{
					if(document.Form1.tbIsMeetingMinutes.value == 'Y')
					{
						url = url + "&IsMee=Y";
					}
				}
				if(appID > 0 && url.indexOf("AppID") < 0)
					url = url + "&AppID=" + appID;
				url = url + "&Type="+type;
				document.Form1.tbURL.value = url;
				
				btnSave = window.document.getElementById("_ctl3_ibtnSave");
				if( btnSave != null )
				{
					btnSave.click();
				}
				else
				{				
					window.location.href = url;
				}
			}
			else
			{
				url = url.substring(0, url.length-9);
				if(url.indexOf("&IsSur=Y") == -1)
				{
					if(document.Form1.tbIsSurvey.value == 'Y')
					{
						url = url + "&IsSur=Y";
					}
				}
				if(url.indexOf("&IsMee=Y") == -1)
				{
					if(document.Form1.tbIsMeetingMinutes.value == 'Y')
					{
						url = url + "&IsMee=Y";
					}
				}
				if(appID > 0 && url.indexOf("AppID") < 0)
					url = url + "&AppID=" + appID;
				url = url + "&Type="+type;
				document.Form1.tbURL.value = url;
				window.location.href = url;
			}
		}
	    
	    function Onload()
	    {
			var btnSave = null;
			var interval = 10*60*1000;
			btnSave = window.document.getElementById("_ctl3_btnSave");
			if( btnSave == null )
			{
				btnSave = window.document.getElementById("_ctl3_ibtnSave");
				if( btnSave == null )
				{
					btnSave = window.document.getElementById("_ctl3_Btn_Save");
				}
			}
			
			if( btnSave != null )
			{
				window.setInterval("AutoSave();",interval);
			}
	    }
	    
	    function AutoSave()
		{
			var today = new Date(); 
			var current = today.toLocaleString();
			if(window.confirm("Are you sure to save the application? ("+current+")") )
			{
				var btnSave = null;
				btnSave = window.document.getElementById("_ctl3_btnSave");
				if( btnSave == null )
				{
					btnSave = window.document.getElementById("_ctl3_ibtnSave");
					if( btnSave == null )
					{
						btnSave = window.document.getElementById("_ctl3_Btn_Save");
					}
				}
				if( btnSave != null )
				{
					btnSave.click();
				}
			}
	    }
    </script>

    <script type="text/javascript">
        $(function() {
            $(".TAB_1").children().first().removeClass();
            $(".TAB_1").children().first().addClass("tab_active");

        });
    </script>

</head>
<body>
  
    <span id="proc"></span>
    <form class="mainbox" id="Form1" method="post" enctype="multipart/form-data" runat="server">
    <table cellspacing="0" cellpadding="0" class="table_center">
        <tr>
            <td>
                <img src="../images/logo2.gif" alt="" />
            </td>
        </tr>
        <tr>
            <td>
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td align="right" style="padding-right:10px" id="workflow-top-container"></td>
                    </tr>
                    <tr>
                        <td align="left" valign="middle">    
                            <table class="tabbox" border="0" cellspacing="0" cellpadding="0">
                                <tr class="tabpos">
                                    <td id="tabWorkflow" runat="server">
                                        <%--<a class="tab_link" onclick="javascript: GoToNewTab('Wor');">Workflow</a>--%>
                                    </td>
                                    <td id="tabApplication" runat="server">
                                        <a class="tab_link" onclick="javascript: GoToNewTab('App');">Application</a>
                                    </td>
                                    <td id="tabFeedback" runat="server">
                                        <a class="tab_link" onclick="javascript: GoToNewTab('Fee');">Feedback</a>
                                    </td>
                                    <td id="td_Feedback" runat="server">
                                    </td>
                                    <td id="tabMeetingMinutes" runat="server">
                                        <a class="tab_link" onclick="javascript: GoToNewTab('Mee');">Meeting Minutes</a>
                                    </td>
                                    <td id="td_MeetingMinutes" runat="server">
                                    </td>
                                    <td id="tabAttachment" runat="server">
                                        <%--<a class="tab_link" onclick="javascript: GoToNewTab('Att');">Attachment</a>--%>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr class="line_border">
                        <td>
                        </td>
                    </tr>
                    <tr id="tr_Title" runat="server">
                        <td valign="bottom" align="left" width="100%" height="45">
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr id="Tr1" runat="server">
                                    <td valign="middle" align="left" width="100%">
                                        &nbsp;
                                    </td>
                                    <td class="copy-title" valign="middle" align="right">
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <!--MainBody-->
                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tr>
                                    <td>
                                        <asp:PlaceHolder ID="MainBody" runat="server"></asp:PlaceHolder>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                  
                    
                    <tr>
                        <td>
                           <table width="100%" border="0">
                             
                            <%--图章控件转移到这里--%>
                            <tr>
                                <td id="workflow-stamp-container" style="padding: 10px;">
                                    <uc3:StampCtrl2 ID="StampCtrl2" runat="server" />
                                </td>
                            </tr>
                    
                            <tr>
                                <td class="ar padding_top5 padding_btm20 tab-top-line">
                                    <a class="btn" href="#" title="Goto back to top (返回页面顶部)" style="color: #fff;">Go back to top</a>
                                </td>
                            </tr>
                           <%--<tr>
                                <td class="title_list">
                                    &nbsp;&nbsp;I Promise (我承诺)
                                </td>
                            </tr>
                            <tr>
                                <td class="padding5 ev-request-footer">
                                    <br />
                                    1. I have reviewed ASB's Guidelines for Travel, Lodging and Other Promotional Expenses
                                    in connection with the planning of this trip.<br />
                                    <br />
                                    2. As the applicant, I hereby confirm that:<br />
                                    <br />
                                    <ul class="padding_lft20">
                                        <li style="list-style: disc inside">all the attendees are from and chosen/recommended
                                            by the customer.</li>
                                        <li style="list-style: disc inside">all the information in the application is accurate.</li>
                                        <li style="list-style: disc inside">all the expenses are to be paid directly to the
                                            PDC approved travel agents.</li>
                                        <li style="list-style: disc inside">no per diem/cash will be provided to the attendees.</li>
                                        <li style="list-style: disc inside">the agenda attached to the application approved
                                            by the Legal Department will be strictly followed.</li>
                                    </ul>
                                    <br />
                                </td>
                            </tr>--%>
                        </table> 
                        </td>
                    </tr>
                    
                </table>
                
                <div class="footerbox">
                    &copy; COPYRIGHT 2011 ALCATEL-LUCENT 
                </div>
            </td>
            <td id="td_right" runat="server">
                <asp:TextBox ID="tbIsMeetingMinutes" runat="server" Style="display: none">N</asp:TextBox>
                <asp:TextBox ID="tbIsSurvey" runat="server" Style="display: none">N</asp:TextBox>
                <asp:TextBox ID="tbIsSwitch" runat="server" Style="display: none">1</asp:TextBox>
                <asp:TextBox ID="tbSwitchTab" runat="server" Style="display: none"></asp:TextBox>
                <asp:TextBox ID="tbIsSwitchMM" runat="server" Style="display: none"></asp:TextBox>
                <asp:TextBox ID="tbAppID" runat="server" Style="display: none"></asp:TextBox>
                <asp:TextBox ID="tbURL" runat="server" Style="display: none"></asp:TextBox>
                <asp:Literal ID="litScript" runat="server" Visible="False"></asp:Literal>
            </td>
        </tr>
    </table>
    </form>


<%--页面刷新时显示--%>
<%--<div id="dialog-message" title="Loading..." style="display: none">
	<p>
	    <br />
	    <span class="workflow-loading"></span>
	    <span>Operation in process, please wait...<br /><br />处理中, 请稍候。。。</span>
	</p>
</div>--%>

<%--追加Print, Close, Log按钮--%>
<input type="button" id="workflow-log" style="display: none" />
<input type="button" id="workflow-close" style="display: none" />


</body>
</html>
